/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package tetris.model;

import javax.swing.JLabel;
import tetris.model.navigation.Position;

/**
 * Класс модели игры.
 * @author vadim
 */
public class Model {
    private Glass _glass;
    private Glass _nextFigureWidget;
    private int _score;
    private Judge _judge;
    
    /**
     * Конструктор. 
     */
    public Model() {
        Figure current,next;
        int width = 10;
        int height = 20;
        Position.setHorizontalRange(0, width-1);
        Position.setVerticalRange(0, height+4);
        _glass = new Glass(height,width);
        _nextFigureWidget = new Glass(8,8);
        _nextFigureWidget.setGlassShiftWidth(_glass.width()+1);
        _nextFigureWidget.setGlassShiftHeight(1);
        _score = 0;
        _judge = new Judge(this, _glass, _nextFigureWidget);
    }

    /**
     * Судья модели.
     * @return
     */
    public Judge judge() {
        return _judge;
    }
    
    /**
     * Стакан модели.
     * @return
     */
    public Glass glass() {
        return _glass;
    }

    /**
     * Виджет следующей фигуры модели.
     * @return
     */
    public Glass nextFigureWidget() {
        return _nextFigureWidget;
    }
    
    /**
     * Счет.
     * @return
     */
    public int score() {
        return _score;
    }
    
    /**
     * Функция задания счета.
     * @param score значение.
     */
    public void setScore(int score) {
        if (score >= 0) {
            _score = score;
        }
    }
}
